local callback = function ()
	local path = ('%s'):format(INPUT_PATH)

	local function for_directory(path, func, leaf)
		for file in (leaf and (path / leaf) or path):list_directory() do
			local old_leaf = leaf
			local leaf = (leaf and (leaf / file:filename()) or file:filename())
			if old_leaf then
				local parent_path = fs.path( MDX.output_path / 'resource' / old_leaf )
				if not fs.exists( parent_path ) then
					fs.create_directory(parent_path)
				end
			end
			if fs.is_directory(file) then
				for_directory(path, func, leaf)
			else
				func(file, old_leaf and old_leaf:string())
			end
		end
	end
	
	local for_dir
	for_dir = function (path)
		local rmd = true
		for file in path:list_directory() do
			if fs.is_directory(file) then
				if not for_dir(file) then
					rmd = false
				end
			else
				rmd = false
			end
		end

		if rmd then
			print( '移除路径：', path:string() )
			fs.remove(path)
		end
		return rmd
	end

	for_dir( fs.path(path) )

end

callback()